<template>
  <div>
    御剑乘风来,除魔天地间!===vue3==propsEmits=={{ son }}

    <button @click="sHandle">子向父传值</button>
  </div>
</template>
<script>
import { ref } from 'vue'
export default {
  name: '',
  props: {
    app: {
      type: String
    }
  },
  emits: ['handle'],
  setup (props, { emit }) {
    /* 父向子传值 */
    // console.log(obj, 88);
    const son = ref(props.app)
    /* 子向父 */
    const sHandle = () => {
      //  v2：this.$emit('handle事件名',值)
      // v3:emit('handle事件名',值)
      emit('handle', '我是son')
    }

    return { son, sHandle }

  }
}
</script>
<style lang='less'  scoped>
</style>


<!-- 语法题setup组件传值 -->
<!-- <template>
  <div>
    御剑乘风来,除魔天地间!===vue3
  </div>
</template>
<script setup>
import { defineProps } from 'vue'
// console.log(obj, 8);
const { app } = defineProps({
  app: {
    type: String
  }
})

</script>
<style lang='less'  scoped>
</style> -->